NAME
/precompiled/mpz - bignum program

DESCRIPTION
/precompiled/mpz is a builtin program written in C. It implements large, very large integers. In fact, the only limitation on these integers is the available memory.

The mpz object implements all the normal integer operations. (except xor) There are also some extra operators:

NOTA BENE
This module is only available if libgmp.a was available and found when Pike was compiled.


NAME
create - initialize a bignum

SYNTAX
object Mpz();
or
object Mpz(int|object|float i);
or
object Mpz(string digits, int base);

DESCRIPTION
When cloning an mpz it is by default initalized to zero. However, you can give a second argument to clone to initialize the new object to that value. The argument can be an int, float another mpz object, or a string containing an ascii number. You can also give the number in the string in another base by specifying the base as a second argument. Valid bases are 2-36 and 256.

SEE ALSO
clone


NAME
powm - raise and modulo

SYNTAX
object mpz->powm(int|string|float|object a,int|string|float|object b);

DESCRIPTION
This function returns ( mpz ** a ) % b


NAME
sqrt - square root

SYNTAX
object mpz->sqrt();

DESCRIPTION
This function return the the truncated integer part of the square root of the value of mpz.


NAME
probably_prime_p - is this number a prime?

SYNTAX
int mpz->probably_prime_p();

DESCRIPTION
This function returns 1 if mpz is a prime, and 0 most of the time if it is not.


NAME
gcd - greatest common divisor

SYNTAX
object mpz->gcd(object|int|float|string arg)

DESCRIPTION
This function returns the greatest common divisor for arg and mpz.


NAME
cast - cast to other type

SYNTAX
object mpz->gcd( "string" | "int" | "float" );
or
(string) mpz
or
(int) mpz
or
(float) mpz


DESCRIPTION
This function converts an mpz to a string, int or float. This is
nessesary when you want to view, store or use the result of an mpz
calculation.

SEE ALSO
cast


NAME
digits - convert mpz to a string

SYNTAX
string mpz->digits();
or
string mpz->digits(int base);

DESCRIPTION
This function converts an mpz to a string. If a base is given the number will be represented in that base. Valid bases are 2-36 and 256. The default base is 10.

SEE ALSO
mpz->cast


NAME
size - how long is a number

SYNTAX
string mpz->size();
or
string mpz->size(int base);

DESCRIPTION
This function returns how long the mpz would be represented in the specified base. The default base is 2.

SEE ALSO
mpz->digits